
*This file conducts the anaalysis on the established workers. 

global municipality mun39


/////////////////////////////////
*-- 1950 census data
/////////////////////////////////


*Import the ready-made 1950 population census

use "W:\Matti M\vl50.dta" , clear


*Cleaning the census data

destring PIKA50, gen(age50)
drop PIKA50

label var age50 "Age in 1950"
destring age50, replace
gen byear=1950-age50


rename sp fem
destring fem, replace
replace fem=fem-1


rename TOLA50 ind50
label var ind50 "Industry in 1950"
destring ind50, replace


rename AKUNU50 mun50
label var mun50 "Municipality of residence, 1950"
rename sykunu mun_birth
label var mun_birth "Municipality of birth"
rename AKUNU39 mun39
label var mun39 "Municipality of residence, 1939"

rename AMAS50 occstat50
label var occstat50 "Occupational status 1950 (AMAS50)"
destring occstat50, replace
label def occstat50 0 "Entrepeneur with employees" 1 "Entrepeneur wo/ employees" 2 "Manager" 3 "White-collar worker" 4 "Blue-collar worker" ///
	5 "Ass fam: white-collar" 6 "Ass fam: blue-collar"  7 "Ass fam: white or blue" 9 "Out of labor force"
label val occstat50 occstat50
tab occstat50

rename KOULU50 school50
label var school50 "Type of school in 1950"
replace school50="99" if school50=="X"
destring school50, replace
label def school50 0 "Kansakoulu" 1 "Oppikoulu" 2 "Korkeakoulu" 3 "Kansan- ja ty򶤥nopistot" ///
		4 "Kansakouluopettajaseminaarit" 5 "MMK oppilaitokset" 6 "Kauppaoppilaitokset" 7 "Tekniset oppilaitokset" ///
		8 "Muut ammatilliset" 9 "Muut, tuntematon" 99 "not in school", add
label val school50 school50		
tab school50 if school50!=99

rename SITA50 edu50
destring edu50, replace
label var edu50 "Education in 1950"
label def edu50 1 "Kansakoulu" 2 "Keskikoulu" 3 "Ylioppilas" 9 "None, unknown", add
label val edu50 edu50
tab byear edu50


*Classify industry in 1950
gen primary50_individual=(ind50<200)
gen manufacturing_50=(ind50>199&ind50<400|ind50==900)


*Only keep those with industry 1950
drop if ind50>900


rename TOLA39 ind39
label var ind39 "Industry in 1939"
destring ind39, replace

*primary also has forestry
gen primary39=(ind39<6)


tempfile data50
save `data50' 

sum age50



*Join with the war reparations shock to the 1939 municipality
joinby $municipality using "$temp\shiftshare.dta" 



global municontrols  agrishare_1940 manushare_1940 town city 


/////////////////////////////////////
*-- REGRESSIONS 1950
/////////////////////////////////////


egen muni39_g=group($municipality)


*Limit to established workers
keep if age50>=25&age50<=45


/////////////////////////////////////
*-- Table 8 Panel A
/////////////////////////////////////

*Structural transformation


reghdfe primary50_individual bartik_standardized   $municontrols  , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Agriculture
estadd local established "Yes"
estimates store p1
sum primary50_individual
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)


reghdfe manufacturing_50 bartik_standardized   $municontrols , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Manufacturing
estimates store ma1
estadd local established "Yes"
sum manufacturing_50
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)


reghdfe primary50_individual bartik_standardized   $municontrols   if primary39==1, a(fem byear  laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "Yes"
estimates store Agriculture
estimates store p2
sum primary50_individual if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)


reghdfe manufacturing_50 bartik_standardized     $municontrols  if primary39==1, a(fem  laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "Yes"
estimates store Manufacturing
estimates store ma2
sum manufacturing_50 if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)



reghdfe primary50_individual bartikhs_st  bartikls_st  $municontrols   , a(fem byear  laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "Yes"
estimates store Agriculture
estimates store p4
sum primary50_individual
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)


reghdfe manufacturing_50 bartikhs_st  bartikls_st      $municontrols  , a(fem byear  laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "Yes"
estimates store Agriculture
estimates store ma4
sum primary50_individual
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)



preserve
replace bartik_standardized=bartiknotimber_st
reghdfe primary50_individual bartik_standardized  $municontrols   , a(fem byear  laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "No"
estimates store Agriculture
estimates store p3
sum primary50_individual
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)

reghdfe manufacturing_50 bartik_standardized     $municontrols  , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estadd local established "No"
estimates store Agriculture
estimates store ma3
sum primary50_individual
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
restore 


label var bartik_standardized Exposure
label var bartikhs_st "HS Exposure"
label var bartikls_st "LS Exposure"


esttab p1 p2 p3 p4 ma1 ma2 ma3 ma4  ///
using "$temp\tables\TABLE8_a.tex", ///
mgroups("Agriculture 1950" "Manufacturing 1950" , pattern(1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) ///
span erepeat(\cmidrule(lr){@span}) ) ///
replace keep(bartik_standardized bartikhs_st bartikls_st) nonotes ///
b(%9.3f) se(%9.3f)  stats(N sample established  ymean  , fmt(0 3) layout(@ @ @) ///
labels("N" "Sample" "Established"  "Y mean")) label star(* .1 ** .05 *** .01)   nodepvars nomtitle



/////////////////////////////////////
*-- Save samples for Bartik robustness checks 
/////////////////////////////////////

gen ind=1
preserve
keep  if primary39==1 
collapse $municontrols   primary50_individual  bartik bartik_standardized laani50 manufacturing_50 bartiknotimber_st  bartikhs_st  bartikls_st (sum) ind , by(mun39)
rename ind wei
save "$temp\bartik_50_c_agri", replace
restore

preserve
collapse $municontrols     primary50_individual bartik bartik_standardized bartiknotimber_st  bartikhs_st  bartikls_st  laani50 manufacturing_50 (sum) ind , by(mun39)
rename ind wei
save "$temp\bartik_50_c", replace
restore

save "$temp\oldgen_50_temp", replace


/////////////////////////////////////
*-- Robustness
/////////////////////////////////////

do "$temp\Replication\Code\robustness_1950_run.do"


/////////////////////////////////////
*Heterogeneity
/////////////////////////////////////

*Join with the municipal-level variables for heterogeneity

joinby mun39 using  "$temp\heterogeneity", unmatched(master)

reghdfe  primary50_individual   bartik_standardized high_yos high_income railway $municontrols  , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store h1
sum primary50_individual 
estadd scalar ymean=r(mean)

reghdfe  primary50_individual   bartik_standardized bartik_income high_yos high_income railway $municontrols , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store h2
sum primary50_individual 
estadd scalar ymean=r(mean)

reghdfe  primary50_individual   bartik_standardized bartik_rail high_yos high_income railway $municontrols  , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store h3
sum primary50_individual 
estadd scalar ymean=r(mean)

reghdfe  primary50_individual   bartik_standardized bartik_yos high_yos high_income railway $municontrols , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store h4
sum primary50_individual 
estadd scalar ymean=r(mean)


/////////////////////////////////////
*-- Link to 1970
/////////////////////////////////////


tempfile data50
keep $municontrols manushare_1940 income_tax_payers38 ln_salary bartik ind shnro fem byear laani50 muni39_g bartik_standardized primary39 age50 mun39 mun50 high_yos  high_income railway bartik_income bartik_rail bartik_yos  manu_quartile agri_quartile bartik_high  bartikq2 bartikq3 bartikq4   bartiknotimber_st  bartikhs_st  bartikls_st ind39
save `data50' 

*Keep the unlinked in the data. Not in the analysis
replace shnro="XXXX" if shnro==""


preserve 

*Import the 1970 information from the ready-made 1970-1985 census data

use "D:\ready-made\FOLK_vl_7085\vl7085_1.dta" if vuosi==1970 , clear

*Import the 1971 and 1975 income data previously created

joinby shnro using  "$temp\1970_1975_income_ranks", unmatched(both)

drop _merge
tempfile data70
save `data70' 
restore 


*Link the 1950 data to the 1970s data via encryoted social security numbers

joinby  shnro using `data70', unmatched(master)

*gen variable for the link rate 
gen link=(_merge==3)
tab vuosi

gen age70=age50+20

*Create industry of occupation groups using the TOL79 classification in the 1970 census

destring toimiala, gen(toimiala_2)

gen two_d_to79=substr(toimiala,1,2)

*Agriculture 1970
gen primary70_individual=(two_d_to79=="11"|two_d_to79=="12"|two_d_to79=="13")


*Manufactruing 1970
gen manufacturing70_individual=(two_d_to79=="37"|two_d_to79=="38"|two_d_to79=="31"|two_d_to79=="32"|two_d_to79=="33"|two_d_to79=="34"|two_d_to79=="35"|two_d_to79=="36")

gen not_primary_70=(primary70_individual!=1)



/////////////////////////////////////
*-- REGRESSIONS 1970
/////////////////////////////////////


/////////////////////////////////////
*-- Table 8 panel B
/////////////////////////////////////


reghdfe primary70_individual bartik_standardized   $municontrols  , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Agriculture 
estimates store p1
sum primary70_individual  
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

reghdfe manufacturing70_individual bartik_standardized    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Manufacturing 
estimates store ma1
sum manufacturing70_individual 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe primary70_individual bartik_standardized    $municontrols     if primary39==1, a(fem byear laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Agriculture 
estimates store p2
sum primary70_individual if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe manufacturing70_individual bartik_standardized    $municontrols   if primary39==1, a(fem byear laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Manufacturing 
estimates store ma2
sum manufacturing70_individual if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

*Low and high skill Bartik measure 

reghdfe primary70_individual bartikhs_st  bartikls_st    $municontrols  , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Agriculture 
estimates store p4
sum primary70_individual  
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe manufacturing70_individual bartikhs_st  bartikls_st     $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Manufacturing 
estimates store ma4
sum manufacturing70_individual 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


*Without established in the Bartik measure 

preserve
replace bartik_standardized=bartiknotimber_st
reghdfe primary70_individual bartik_standardized  $municontrols  , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Agriculture 
estimates store p3
sum primary70_individual  
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "No"


reghdfe manufacturing70_individual bartik_standardized     $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store Manufacturing 
estimates store ma3
sum manufacturing70_individual 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "No"
restore

label var bartik_standardized "Exposure"
label var bartikhs_st "HS Exposure"
label var bartikls_st "LS Exposure"



label var bartik_standardized Exposure

esttab p1 p2 p3 p4 ma1 ma2 ma3 ma4  ///
using "$temp\tables\TABLE8_b.tex", ///
mgroups("Agriculture 1970" "Manufacturing 1970", pattern(1 0 0 0 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) ///
span erepeat(\cmidrule(lr){@span}) ) ///
replace keep(bartik_standardized bartikhs_st bartikls_st) nonotes ///
b(%9.3f) se(%9.3f)  stats(N sample established  ymean  , fmt(0 3) layout(@ @ @) ///
labels("N" "Sample" "Established" "Y mean")) label star(* .1 ** .05 *** .01) nodepvars nomtitle


/////////////////////////////////////
*-- Table 8 panel C
/////////////////////////////////////

*Incomes (average 1971 and 1975)


reghdfe ln_svatv bartik_standardized    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income1 
sum ln_svatv 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

reghdfe income_rank bartik_standardized    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income2 
sum income_rank 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

reghdfe ln_svatv bartik_standardized   $municontrols  if primary39==1, a(fem byear laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income3 
sum ln_svatv if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

reghdfe income_rank bartik_standardized   $municontrols  if primary39==1, a(fem byear laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income4 
sum income_rank if primary39==1
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

*Without the Established

preserve
replace bartik_standardized=bartiknotimber_st
reghdfe ln_svatv bartik_standardized    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income5 
sum ln_svatv 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "No"

reghdfe income_rank bartik_standardized    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income6
sum income_rank 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "No"
restore 

*Low skill and high skill 

reghdfe ln_svatv  bartikhs_st bartikls_st      $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income7
sum ln_svatv 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

reghdfe income_rank bartikhs_st bartikls_st    $municontrols   , a(fem byear laani50) cl(muni39_g)
estadd local sample "All"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store income8
sum income_rank 
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"

label var bartik_standardized "Exposure"
label var bartikhs_st "HS Exposure"
label var bartikls_st "LS Exposure"

esttab  income1 income3 income5 income7 income2 income4  income6 income8 ///
using "$temp\tables\TABLE8_c.tex", ///
mgroups( "Ln Income" "Income Rank", pattern( 1 0 0 0 1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) ///
span erepeat(\cmidrule(lr){@span}) ) ///
replace keep(bartik_standardized bartikls_st bartikhs_st)  nonotes ///
b(%9.3f) se(%9.3f)  stats(N sample established ymean  , fmt(0 3) layout(@ @ @) ///
labels("N" "Sample" "Established" "Y mean")) label star(* .1 ** .05 *** .01) nodepvars nomtitle


/////////////////////////////////////
*Appendix table D.14
/////////////////////////////////////

gen bartik_standardized_primary39=primary39*bartik_standardized

global municontrols2  c.agrishare_1940#primary39 c.manushare_1940#primary39 town#primary3 city#primary39 

reghdfe ln_svatv bartik_standardized   $municontrols  if primary39==1, a(fem byear laani50) cl(muni39_g)
estadd local sample "Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store r_income2
sum ln_svatv if primary39==0
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe ln_svatv bartik_standardized   $municontrols  if primary39==0&ind39!=99, a(fem byear laani50) cl(muni39_g)
estadd local sample "Not Agriculture 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store r_income3
sum ln_svatv if primary39==0&ind39!=99
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe ln_svatv bartik_standardized  bartik_standardized_primary39 primary39  $municontrols  if  ind39!=99, a(fem byear laani50) cl(muni39_g)
estadd local sample "All with industry 1939"
estadd local controls "\checkmark"
estadd local cfe "\checkmark"
estadd local rfe "\checkmark"
estimates store r_income4
sum ln_svatv if  ind39!=99
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


reghdfe ln_svatv bartik_standardized  bartik_standardized_primary39 primary39  $municontrols2  if  ind39!=99, a(fem#primary39 byear#primary39 laani50#primary39) cl(muni39_g)
estadd local sample "All with industry 1939"
estadd local controls "\checkmark"
estadd local cfe ""
estadd local rfe "\checkmark"
estadd local icfe "\checkmark"
estimates store r_income5
sum ln_svatv if  ind39!=99
estadd scalar ymean=r(mean)
estadd scalar ysd=r(sd)
estadd local established "Yes"


label var bartik_standardized_primary39 "Exposure x Agriculture 1939"
label var primary39 "Agriculture 1939"


esttab   r_income2 r_income3 r_income4 r_income5 ///
using "$temp\tables\ln_income_appendix_ind39_2.tex", ///
mgroups( "Ln Income" , pattern( 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) ///
span erepeat(\cmidrule(lr){@span}) ) ///
replace keep(bartik_standardized bartik_standardized_primary39 primary39)  nonotes ///
b(%9.3f) se(%9.3f)  stats(N sample established ymean cfe icfe , fmt(0 3) layout(@ @ @) ///
labels("N" "Sample" "Established" "Y mean" "Controls" "Controls x Agriculture 1939" )) label star(* .1 ** .05 *** .01) nodepvars nomtitle


*Save sample for Robustness analysis
save "$temp\oldgen_70_temp", replace



/////////////////////////////////////
*Heterogeneity table D.20
/////////////////////////////////////


reghdfe  ln_svatv   bartik_standardized high_yos high_income railway $municontrols  , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store l1
sum ln_svatv 
estadd scalar ymean=r(mean)

reghdfe  ln_svatv   bartik_standardized bartik_income high_yos high_income railway $municontrols , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store l2
sum ln_svatv 
estadd scalar ymean=r(mean)

reghdfe  ln_svatv   bartik_standardized bartik_rail high_yos high_income railway $municontrols  , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store l3
sum ln_svatv 
estadd scalar ymean=r(mean)

reghdfe  ln_svatv   bartik_standardized bartik_yos high_yos high_income railway $municontrols , a(byear fem laani50) cl(muni39_g)
estadd local g "25-45"
estimates store l4
sum ln_svatv 
estadd scalar ymean=r(mean)

labe var bartik_standardized "Exposure"
labe var bartik_income "Exposure x High income"
labe var bartik_rail "Exposure x Railway"
labe var bartik_yos "Exposure x High Education"


esttab h1 h2 h3 h4 l1 l2 l3 l4 ///
using "$temp\tables\TABLE_heterogeneity_old.tex", ///
mgroups("Primary 1950"  "Ln Income", pattern(1 0 0 0 1 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) ///
span erepeat(\cmidrule(lr){@span}) ) ///
replace keep(bartik_standardized bartik_income bartik_rail bartik_yos) nonotes ///
b(%9.3f) se(%9.3f)  stats(N  ymean g, fmt(0 3) layout(@ @ @) ///
labels("N"  "Y mean" "Sample")) label star(* .1 ** .05 *** .01) nodepvars nomtitle




/////////////////////////////////////
*-- Robustness
/////////////////////////////////////


do "$temp\Replication\Code\robustness_1970_run.do"


/////////////////////////////////////
*-- Save samples for Bartik robustness
/////////////////////////////////////


preserve
keep  if primary39==1 
collapse $municontrols  svatv income_rank primary70_individual  bartik bartik_standardized laani50 manufacturing70_individual (sum) ind , by(mun39)
rename ind wei
save "$temp\bartik_70_c_agri", replace
restore

preserve
collapse $municontrols  svatv income_rank primary70_individual  bartik bartik_standardized laani50 manufacturing70_individual (sum) ind , by(mun39)
rename ind wei
save "$temp\bartik_70_c", replace
restore
